<%@page contentType="text/html; charset=UTF-8"%>
<%@ taglib uri="http://java.sun.com/jstl/core_rt" prefix="c"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt"%>
<%@page import="java.util.List"%>
<%@page import="java.util.ArrayList"%>
<%@ page import="nc.vo.sm.UserVO"%>
<%@ page import="nc.vo.ebvp.logindex.pojo.Constant"%>
<%@page import="nc.bs.ebvp.prodpricemaintain.form.SingleProdPriceForm"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
        "http://www.w3.org/TR/html4/loose.dtd">
<%@ taglib uri="/WEB-INF/lang-support.tld" prefix="lang-support"%>
<html>
	<head>

		<%
			String basepath = request.getContextPath();
			String suppName = "";
			Object obj = session.getAttribute("suppName");
			if (obj != null) {
				suppName = obj.toString();
			}
		%>

		<%
			String i = "1";
		%>

		<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
		<title resid="0ec22200-000001">Yonyou NC － 产品价格维护</title>

		<link rel="stylesheet" type="text/css"
			href="<%=basepath%>/commonres/common/frame/src/css/subpage_prod.css" />
		<link rel="stylesheet" type="text/css"
			href="<%=basepath%>/commonres/common/list_pager/src/css/list_pager.css" />
		<link rel="stylesheet" type="text/css" href="<%=basepath%>/commonres/common/frame/src/css/picker.css" />
		<link rel="stylesheet" type="text/css" href="<%=basepath%>/commonres/common/frame/src/css/validator.css" />
		<link rel="stylesheet" type="text/css" href="commonres/common/frame/src/css/purorg.css" />
		
		<script type="text/javascript"
			src="<%=basepath%>/commonres/common/frame/src/js/messages_cn.js"></script>
		<script type="text/javascript"
			src="<%=basepath%>/commonres/common/frame/src/js/selfservice_prodpricemaintain.js"></script>
		<script type="text/javascript"
			src="<%=basepath%>/commonres/common/frame/src/js/selfservice_menu.js"></script>
		<script type="text/javascript"
			src="<%=basepath%>/commonres/common/frame/src/js/common_validate.js"></script>
		<script type="text/javascript"
			src="commonres/common/frame/src/js/purorg_head.js"></script>
	
		<script type="text/javascript">
		    var ebvp_context="<%=basepath%>";
			var pUpInex = "${PAGEINFO.pUpIndex}";
			var pDownIndex = "${PAGEINFO.pDownIndex}";
			
			$(function() {
		    	$( "#prodpriceMaintain" ).parents("ul").find(".current").removeClass("current");
				$( "#prodpriceMaintain" ).addClass("current");
			 });
			
			//下一页
			function nextPage(){
				document.prodQueryForm.action="<%=basepath%>/prodprice/queryprodpricebycond";
				document.getElementById("pageno").value="${PAGEINFO.pDownIndex}";
	    		document.prodQueryForm.submit();
			}
		   //上一页
		   function lastPage(){
			   document.prodQueryForm.action="<%=basepath%>/prodprice/queryprodpricebycond";
			   document.getElementById("pageno").value="${PAGEINFO.pUpIndex}";
	   		   document.prodQueryForm.submit();
		   }
		   //到第n页
		   function nPage(n){
			   document.prodQueryForm.action="<%=basepath%>/prodprice/queryprodpricebycond";
			   document.getElementById("pageno").value=n;
	   		   document.prodQueryForm.submit();		   
		   } 
		   
		
			// 编辑态和浏览态的checkbox保持一致
			$(function() {
				$('form[name=productListForm] :checkbox').live(
						'click',
						function() {
							var id = $(this).val();
							var isCheck = $(this).attr('checked') == 'checked';
							$(this).parents('form').find(
									'input:checkbox[value=' + id + ']').attr(
									'checked', isCheck);
						});
			});
		</script>
		<lang-support:langres resid="ec22400_0;ec22200_0" />
	</head>
	<body>

			<div id="productPicker" class="tree_picker" style="background: white; position: absolute; z-index: 9999; display: none; border: #e0e0e0 2px solid;">
				<div class="picker_title">
					<strong resid="0ec22200-000002">产品列表</strong>
				</div>
				<!-- 组织 -->
				<div class="form_row">
					<div class="form_title">
						<lang-support:wp resid="ec22380_0" key="0ec22380-000014" />
					</div>
					<div class="form_field">
						<label>
							<input id="qryPurOrg" name="qryPurCorpName"
								value="${qryPurCorpName}" type="text"
								class="textfield pd_5x2px w_178px"
								readonly />
							<input id="pk_purOrg" name="qryPkPurCorp"
								value="${qryPkPurCorp}" type="hidden" />
						</label>
					</div>
				</div>
				<div class="form_row"> </div>
				<div class="list_header">
					<span class="w_126px" resid="0ec22200-000003">产品</span>
					<span class="w_126px" resid="0ec22200-000004">规格</span>
					<span class="w_126px" resid="0ec22200-000005">型号</span>
				</div>
				<div id="prod_tree" class="tree_list" style="height:246px">
				</div>
				<div class="tree_btn_panel">
					<div class="tree_btns">
						<div id="prodPkChecked">
						</div>
						<a id="productPicked" class="idBtnPicked btn_orange">
							<span class="w_66px h_18px" resid="0ec22200-000006">确定</span> </a>
						<a id="productCancel" class="idBtnCancel btn_gray"> <span
							class="w_66px h_22px" resid="0ec22200-000007">取消</span> </a>
					</div>
				</div>
			</div>
		<!-- 弹出的组织列表 -->
		<div id="purOrgHeadPicker" class="org_tree_pickerSmall" style="background: white; position: absolute; z-index: 9999; display: none; border: #e0e0e0 2px solid;">
			<form  id="orgQueryForm" name="orgQuery" method="post">
			<div class="picker_title">
				<strong resid="0ec22200-000077">采购组织列表</strong>
					<a id="filterPurOrg" name="filterPurOrg" class="btn_gray" style="float:right;margin-top:2px;margin-right:10px;">
						<span resid="0ec22200-000078" class="w_60px h_25px ft_12px">名称过滤</span>
					</a>								
				<input style="float:right;width:60px;margin-top:3px;margin-right:4px;" type="text" id="org_filter" name="org_filter" value=""/>
			</div>
			<div class="tree_list12" style="height:265px;width:417px">			
			</div>
			<div class="tree_btn_panel12">
				<div class="tree_btns12">
					<a id="orgPicked" class="idBtnPicked btn_orange"> 
						<span	class="w_66px h_18px" resid="0ec22200-000006">确定</span> </a>
					<a id="orgCancel" class="idBtnCancel btn_gray"> <span
						class="w_66px h_22px" resid="0ec22200-000007">取消</span> </a>
				</div>
			</div>
		</div>
		<script type="text/javascript">
			$("#purOrgHeadPicker").hide();
		</script>

		<!-- Document Content -->
		<div class="float_center doc_width">
			<div class="doc_content_shadow">
				<div class="doc_content">
					<div id="columnLeft" class="frame_column_left">
					</div>
					<div class="frame_right_miniheight">
						<div class="location_bar">
							<a href="<%=basepath%>/infopub/pubmain" resid="0ec22400-000012">首页</a>
							<a resid="0ec22200-000009">自助服务</a>
							<span resid="0ec22200-000010">产品价格维护</span>
						</div>
						<div class="subpage_query_form pd_10x0px mrg_top10px">
							<form id="prodQueryForm" name="prodQueryForm" method="post">
								<div class="form_row">
									<div class="form_title w_126px" resid="0ec22200-000011">
										产品分类名称：
									</div>
									<input name="qryProdCateName"
										value="${QUERY_FORM.qryProdCateName}"
										class="textfield pd_5x2px w_191px" />
								</div>
								<div class="form_row">
									<div class="form_title w_126px" resid="0ec22200-000012">
										产品名称：
									</div>
									<label>
										<input name="qryProdName" value="${QUERY_FORM.qryProdName}"
											class="textfield pd_5x2px w_191px" />
										<input type="hidden" name="pageno" id="pageno" value="" />
									</label>
								</div>
							</form>
							<div class="float_left w_766px" style="margin-left:-50px">
								<div class="query_form_btn">
									<a  id="queryProdPriceList" class="btn_orange" > <span
										class="w_80px h_22px" resid="0ec22200-000013">查询</span> </a>
								</div>
							</div>
						</div>
						
						<div class="subpage_table">
							<form name="productListForm" id="productListForm" method="post">
								<table id="productListTable" border="0" cellpadding="0"
									cellspacing="0" style="font-size: 12px">
									<thead style="font-weight: bold">
										<td resid="0ec22200-000014" width='28'>
											选中
										<td resid="0ec22200-000076" width='110'>
											组织
										</td>
										<td resid="0ec22200-000015" width='110'>
											产品
										</td>
										<td resid="0ec22200-000016" width='104'>
											单位/币种
										</td>
										<td resid="0ec22200-000017" width='138'>
											价格
										</td>
										<td resid="0ec22200-000018" width='128'>
											生效失效日期
										</td>
										<td resid="0ec22200-000019" width='128'>
											备注
										</td>
										<td resid="0ec22200-000020" width="50">
											维护
										</td>
									</thead>
									<tbody>
										<c:if test="${PROD_PRICE_SFORM_LIST != null}">
											<c:forEach items="${PROD_PRICE_SFORM_LIST}" var="item"
												varStatus="index">
												<c:if test="${index.index%2==0}">
													<tr id="trid_${index.index+1}" style="display: none"
														targetid="hide_trid_${index.index+1}">
												</c:if>
												<c:if test="${index.index%2==1}">
													<tr class="odd" id="trid_${index.index+1}"
														style="display: none" targetid="hide_trid_${index.index+1}">
												</c:if>
												<td class="checkboxCol">
													<input type="checkbox" name="isCommited" 
														value="${item.primaryKey}" />
												</td>
												<td>
													<span title="org_name">${item.org_name}</span>											
   												</td>
												<td>
													<span title="prod_name">${item.prod_name}</span>
													<br />
													<c:if test="${item.module!=null}"><span resid="0ec22200-000021">规格：</span>${item.module}<br />
													</c:if>
													<c:if test="${item.type!=null}"><span resid="0ec22200-000022">型号：</span>${item.type}</c:if>
												</td>
												<td>
													<span resid="0ec22200-000023">单位:</span>
													<select name="pk_unit">
														<option value="${item.pk_unit}" selected>
															${item.unit}
														</option>
													</select>
													<br />
													<span resid="0ec22200-000024">币种:</span>
													<select name="pk_currency">
														<option value="${item.pk_currency}" selected>
															${item.currency_name}
														</option>
													</select>
												</td>
												<td>
													<span resid="0ec22200-000025">含税单价:</span>
													<input name="tax_unit_price" id="tax_unit_price_${index.index+1}" type="text"
														value="${item.tax_unit_price}" class="prod_textfield w_66px" />
													<br />
													<span resid="0ec22200-000026">无税单价:</span>
													<input name="tax_free_unit_price" id="tax_free_unit_price_${index.index+1}" type="text"
														value="${item.tax_free_unit_price}"
														class="prod_textfield w_66px" />
													<br />
													<span style="visibility:hidden" resid="0ec22200-000073">空白</span><span resid="0ec22200-000027">税率:</span>
													<input name="tax_rate" id="tax_rate_${index.index+1}" type="text" value="<fmt:formatNumber value="${item.tax_rate}" pattern="0.00"/>"
														class="prod_textfield w_66px" />
												</td>
												<td>
													<span style="float:left" resid="0ec22200-000028">生效日期:</span>
													<input name="valid_date" id="valid_date${index.index+1}"
														type="text" value="${item.valid_date}" 
														class="textfieldnew pd_5x2px datepicker"  data-datepicker-onSelect="window.onDatePickerSelect(this)" style="width:68px;"/>
													<br />
													<span style="float:left" resid="0ec22200-000029">失效日期:</span>
													<input name="invalid_date" id="invalid_date${index.index+1}"
														type="text" value="${item.invalid_date}" data-datepicker-onSelect="window.onDatePickerSelect(this)" 
														class="textfieldnew pd_5x2px datepicker" style="width:88px;" />
												</td>
												<td>
													<span resid="0ec22200-000030">生产厂商:</span>
													<select name="pk_manufactory">
														<option value="${item.pk_manufactory}" selected>
															${item.manufactory_name}
														</option>
													</select>
													<br />
													<span resid="0ec22200-000031">运输方式:</span>
													<select name="pk_transport_type">
														<option value="${item.pk_transport_type}" selected>
															${item.transport_type}
														</option>
													</select>
												</td>
												<td>
													<a name="saveProdBtn" ><span class="saveLink"></span></a>
													<a name="deleteProdBtn" ><span class="deleteLink"></span></a>
													<!-- 下面是隐藏字段 -->
													<input name="primaryKey" type="hidden"
														value="${item.primaryKey}" />
													<input name="prod_cate_pk" type="hidden"
														value="${item.prod_cate_pk}" />
													<input name="pk_prod_v" type="hidden"
														value="${item.pk_prod_v}" />
													<input name="pk_Org" type="hidden"
														value="${item.pk_org}" />
												</td>
												</tr>
	
												<!-- 以下为隐藏tr的处理  -->
												<c:if test="${index.index%2==0}">
													<tr id="hide_trid_${index.index+1}"
														targetid="trid_${index.index+1}">
												</c:if>
												<c:if test="${index.index%2==1}">
													<tr class="odd" id="hide_trid_${index.index+1}"
														targetid="trid_${index.index+1}">
												</c:if>
												<td class="checkboxCol">
													<input type="checkbox" name="isCommited"
														value="${item.primaryKey}" />
												</td>
												<td>
													<span title="org_name">${item.org_name}</span>	
												</td>	
												<td>
													<span title="prod_name">${item.prod_name}</span>
													<br />
													<c:if test="${item.module!=null}"><span resid="0ec22200-000034">规格：</span>${item.module}<br />
													</c:if>
													<c:if test="${item.type!=null}"><span resid="0ec22200-000035">型号：</span>${item.type}</c:if>
												</td>
												<td>
													<span title="hide_unit"><span resid="0ec22200-000036">单位:</span>${item.unit}</span>
													<br />
													<span title="hide_currency_name"><span resid="0ec22200-000037">币种:</span>${item.currency_name}</span>
												</td>
												<td>
													<span resid="0ec22200-000038">含税单价:</span>
													<span title="hide_tax_unit_price">${item.tax_unit_price}</span>
													<br />
													<span resid="0ec22200-000039">无税单价:</span>
													<span title="hide_tax_free_unit_price">${item.tax_free_unit_price}</span>
													<br />
													<span style="visibility:hidden"  resid="0ec22200-000073">空白</span><span resid="0ec22200-000040">税率:</span>
													<span title="hide_tax_rate"><fmt:formatNumber value="${item.tax_rate}" pattern="0.00"/></span>
												</td>
												<td>
													<span resid="0ec22200-000041">生效日期:</span>
													<span title="hide_valid_date">${item.valid_date}</span>
													<br />
													<span resid="0ec22200-000042">失效日期:</span>
													<span title="hide_invalid_date">${item.invalid_date}</span>
												</td>
												<td>
													<c:if test="${item.manufactory_name!=null}">
														<span title="hide_manufactory_name"><span resid="0ec22200-000043">生产厂商:</span>${item.manufactory_name}</span>;
														<br />
													</c:if>
													<c:if test="${item.transport_type!=null}">
														<span title="hide_transport_type" ><span resid="0ec22200-000044">运输方式:</span>${item.transport_type}</span>
													</c:if>
													&nbsp;
												</td>
												<td>
													<a name="modifyProdBtn"><span class="modifyLink"></span></a>
													<a name="deleteProdBtn"><span  class="deleteLink"></span></a>
												</td>
												</tr>
											</c:forEach>
										</c:if>
									</tbody>
								</table>
							</form>

							<form id="calpriceform" name="calpriceform" method="post">
								<!-- 集团 -->
								<input type="hidden" id="pk_group_cal" name="pk_group_cal"
									value="" />
								<!-- 组织 -->
								<input type="hidden" id="pk_org_cal" name="pk_org_cal" value="" />
								<!-- 产品 -->
								<input type="hidden" id="pk_prod_cal" name="pk_prod_cal"
									value="" />
								<!-- 报价币种 -->
								<input type="hidden" id="pk_currency_cal" name="pk_currency_cal"
									value="" />
								<!-- 报价单位 -->
								<input type="hidden" id="pk_unit_cal" name="pk_unit_cal"
									value="" />
								<!-- 主单位 -->
								<input type="hidden" id="pk_primary_unit_cal"
									name="pk_primary_unit_cal" value="" />
								<!-- 报价数量 -->
								<input type="hidden" id="amount_cal" name="amount_cal" value="" />
								<!-- 主数量 -->
								<input type="hidden" id="primary_amount_cal"
									name="primary_amount_cal" value="" />
								<!-- 换算率 -->
								<input type="hidden" id="conversion_rate_cal"
									name="conversion_rate_cal" value="" />
								<!-- 扣税类别 -->
								<input type="hidden" id="tax_type_cal" name="tax_type_cal"
									value="" />
								<!-- 税率 -->
								<input type="hidden" id="tax_rate_cal" name="tax_rate_cal"
									value="" />
								<!-- 折扣率 -->
								<input type="hidden" id="discount_rate_cal"
									name="discount_rate_cal" value="" />
								<!-- 含税单价 -->
								<input type="hidden" id="has_tax_price_cal"
									name="has_tax_price_cal" value="" />
								<!-- 含税金额 -->
								<input type="hidden" id="has_tax_sum_cal" name="has_tax_sum_cal"
									value="" />
								<!-- 含税净价 -->
								<input type="hidden" id="has_tax_net_price_cal"
									name="has_tax_net_price_cal" value="" />
								<!-- 主含税净价 -->
								<input type="hidden" id="primary_hastax_net_price_cal"
									name="primary_hastax_net_price_cal" value="" />
								<!-- 无税单价 -->
								<input type="hidden" id="no_tax_price_cal"
									name="no_tax_price_cal" value="" />
								<!-- 无税金额 -->
								<input type="hidden" id="no_tax_sum_cal" name="no_tax_sum_cal"
									value="" />
								<!-- 无税净价 -->
								<input type="hidden" id="no_tax_net_price_cal"
									name="no_tax_net_price_cal" value="" />
								<!-- 主无税净价 -->
								<input type="hidden" id="primary_notax_net_price_cal"
									name="primary_notax_net_price_cal" value="" />
								<!-- 价税合计 -->
								<input type="hidden" id="price_tax_sum_cal"
									name="price_tax_sum_cal" value="" />
								<input type="hidden" id="tax_sum_cal" name="tax_sum_cal"
									value="" />
								<!-- 用于触发计算的字段顺序 -->
								<input type="hidden" id="property_cal" name="property_cal"
									value="" />
								<!-- 参数字段 -->
								<input type="hidden" id="isTaxPrior" name="isTaxPrior" value="" />
								<!-- 计算行 -->
								<input type="hidden" id="row_no" name="row_no" value="" />
							</form>
						</div>

						<table border="0">
							<tr>
								<td colspan="21">
									<a id="addProdBtn" class="btn_add" resid="0ec22200-000047">添加产品</a>
								</td>
							</tr>
						</table>
						<a id="exportProdBtn" class="btn_orange"
							style="margin-left: 5px; float: right;"> <span
							class="w_80px h_22px" resid="0ec22200-000048">导出</span> </a>
						<a id="batchDeleteProdBtn" class="btn_orange" style="float: right;">
							<span class="w_80px h_22px" resid="0ec22200-000049">删除</span> </a>
						
				

					<div class="list_pager">
						<table border="0">
							<tr style="font-size: 12px;">
								<c:if test="${false == PAGEINFO.pUpIsUsed}">
									<td><a class="go_prev disabled"></a></td>
								</c:if>
								<c:if test="${true == PAGEINFO.pUpIsUsed}">
									<td><a class="go_prev" href="javascript:lastPage()"></a>
									</td>
								</c:if>

								<c:forEach items="${PAGEINFO.currPageBtnList}" var="pagebtn">
									<c:if test="${pagebtn.pageIndex == PAGEINFO.currPageIndex}">
										<td><a  class="page_current" href="javascript:void(null)">${pagebtn.showPageCode}</a>
										</td>
									</c:if>
									<c:if test="${pagebtn.pageIndex != PAGEINFO.currPageIndex}">
										<td><a class="page_index" href="javascript:nPage('${pagebtn.pageIndex}')">${pagebtn.showPageCode}</a>
										</td>
									</c:if>
								</c:forEach>

								<c:if test="${false == PAGEINFO.pDownIsUsed}">
									<td><a class="go_next disabled"></a></td>
								</c:if>
								<c:if test="${true == PAGEINFO.pDownIsUsed}">
									<td><a class="go_next" href="javascript:nextPage()"></a>
									</td>
								</c:if>
							</tr>
						</table>
					</div>
						<c:if test="${ERROR_MESSAGE != null}">
							<span class="prod_error_span" id="error_span">${ERROR_MESSAGE}</span>
							<img style="float:right"  
								src="<%=basepath%>/commonres/common/frame/src/img/img_error.png" />
						</c:if>
						<c:if test="${SUCCESS_MESSAGE != null}">
							<span class="prod_error_span" id="error_span">${SUCCESS_MESSAGE}</span>
							<img style="float:right" id="error_msg" 
								src="<%=basepath%>/commonres/common/frame/src/img/img_success.png" />
						</c:if>
				</div>
				</div>
			</div>
		</div>
	</body>
</html>
